<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>学生管理系统-晴空</title>
	<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>public.css">
	<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>list.css">
	<script src="<?php echo (HOME_JS); ?>jquery.min.js"></script>
</head>
<body>
	<div id="header" class="header clearfix">
		<div class="logo left">
			晴空-学生管理系统
		</div>
		<ul class="header-nav right">
			<li>
				<a href="<?php echo U('Manager/login');?>">登陆</a>
			</li>
			<li>
				<a href="<?php echo U('Manager/logout');?>">退出系统</a>
			</li>
		</ul>
	</div>
	<div id="main-wrapper" class="clearfix">
		<div id="side" class="left">
			<ul>
				<h3>学生信息管理</h3>
				<?php if(strstr($auth_path, 'Student-showList') != false): ?><li><a href="<?php echo U('Student/showList');?>">查询学生信息</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Student-addInfo') != false): ?><li><a href="<?php echo U('Student/addInfo');?>">录入学生信息</a></li><?php endif; ?>
			</ul>
			<ul>
				<h3>课程信息管理</h3>
				<?php if(strstr($auth_path, 'Course-showList') != false): ?><li><a href="<?php echo U('Course/showList');?>">查询课程</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Course-addInfo') != false): ?><li><a href="<?php echo U('Course/addInfo');?>">录入课程</a></li><?php endif; ?>
			</ul>
			<ul>
				<h3>学生成绩管理</h3>
				<?php if(strstr($auth_path, 'Score-showList') != false): ?><li><a href="<?php echo U('Score/showList');?>">查询成绩</a></li><?php endif; ?>
				<?php if(strstr($auth_path, 'Score-addInfo') != false): ?><li><a href="<?php echo U('Score/addInfo');?>">录入成绩</a></li><?php endif; ?>
			</ul>
		</div>
		<div id="main" class="right">
			<link rel="stylesheet" href="<?php echo (HOME_CSS); ?>theme.blue.css">
<h1>查询成绩</h1>
<div id="cont">
	<?php if($role_id == 1): ?><div class="table-head clearfix">
			<div class="wrap left">
				<span>班级：</span>
				<select name="" id="class-select" class="class-select">
					<?php if(is_array($class_info)): foreach($class_info as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>" <?php echo ($v['id'] == $class_id ? 'selected' : ''); ?>><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
				</select>
			</div>
			<a href="<?php echo U('Score/addInfo');?>" class="input-btn right">录入信息</a>
		</div>
		<script>
			$(function(){
				$('#class-select').change(function(){
					window.location.href = "<?php echo U('Score/showList');?>" + "?class_id=" + $(this).val();
				});
			});
		</script><?php endif; ?>
	<table id="table" class="table tablesorter-blue">
		<thead>
			<tr>
				<th>学号</th>
				<th>名字</th>
				<?php if(is_array($course_info)): foreach($course_info as $key=>$v): ?><th style="color: #336699;"><?php echo ($v["name"]); ?></th><?php endforeach; endif; ?>
				<th style="color: #336699">总分</th>
			</tr>
		</thead>
		<tbody>
			<?php if(is_array($student_info)): foreach($student_info as $key=>$v): ?><tr>
					<td><?php echo ($v["id"]); ?></td>
					<td><?php echo ($v["name"]); ?></td>
					<?php if(is_array($course_info)): foreach($course_info as $key=>$sub): ?><td style="color: #339933;"><?php echo (getScore($v['id'],$sub['id'])); ?></td><?php endforeach; endif; ?>
					<td></td>
				</tr><?php endforeach; endif; ?>
		</tbody>
	</table>
</div>
<script src="<?php echo (HOME_JS); ?>jquery.tablesorter.js"></script>
<script>
	$(function(){
		// 计算总分数
		$('tr').each(function(key,value){
			var count = 0;
			for(var i=2; i < 8; i++) {
				count += parseInt($(value).find('td').eq(i).text());
			}
			$(value).find('td').eq(8).text(count);
		});

		// 启用table排序功能,并指定第二列不能用于排序
		$("#table").tablesorter({headers:{1:{sorter:false}}});
	});
</script>


		</div>
	</div>
	<div class="footer" id="footer">
		<div class="copyright">
			copyright ---- 晴空
		</div>
	</div>
</body>
</html>